//////////////////////////////////////////////////////////////////////////
#include "MainMenu.h"
#include "Button/Button.h"
#include "Functor/Functor.h"
#include "Application/Application.h"
//////////////////////////////////////////////////////////////////////////
MainMenu::MainMenu()
: Scene("content/MainMenu/MainMenu.xml")
{
	
	Button* btnPlay = new Button();
	btnPlay->setSprites(L"content/MainMenu/BtnPlayPassive.png",
						   L"content/MainMenu/BtnPlayActive.png",
						   L"content/MainMenu/BtnPlayPressed.png"
						   );

	btnPlay->setXY(512, 300);
	btnPlay->setCenterAlign();
	btnPlay->setClickCb(createFunctor(this, &MainMenu::play));
	addChild(btnPlay);
	m_Buttons[L"Play"] = btnPlay;

	Button* btnExit = new Button();
	btnExit->setSprites(L"content/MainMenu/BtnExitPassive.png",
		L"content/MainMenu/BtnExitActive.png",
		L"content/MainMenu/BtnExitPressed.png"
		);

	btnExit->setXY(512, 355);
	btnExit->setCenterAlign();
	btnExit->setClickCb(createFunctor(this, &MainMenu::exit));
	addChild(btnExit);
	m_Buttons[L"Exit"] = btnExit;
}
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
MainMenu::~MainMenu()
{
	m_Buttons.clear();
}
//////////////////////////////////////////////////////////////////////////
void MainMenu::play()
{
	Scene* scene = new Scene("content/scene0/scene0.xml");
	Application::instance()->loadScene(scene);
}
//////////////////////////////////////////////////////////////////////////
void MainMenu::exit()
{
	Application::instance()->exit();
}
//////////////////////////////////////////////////////////////////////////

